﻿  
namespace PatternLib.Responsibility
{
    public abstract class ResponsibilityChain
    {  
        public string? Name { get; set; }

        public ResponsibilityChain? _nextStep;

        public HandleResult HandleResult { get; set; }
        public abstract void Execute(ResponsibilityNode applyContext);
        public void AddNextStep(ResponsibilityChain nextChain)
        {
            _nextStep = nextChain; 
        }

        public void NextStep(ResponsibilityNode applyContext)
        {
            if (_nextStep != null)
            {
                _nextStep.Execute(applyContext);
            }
        }
    }
  
}
